package com.youyun.xiaoyuan.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.youyun.xiaoyuan.R;
import com.youyun.xiaoyuan.adapter.TablayoutFragmentPager;
import com.youyun.xiaoyuan.base.BaseFragment;

/**
 * Created by Wood on 2015-12-6.
 */
public class SocialFragment extends BaseFragment
{
    TabLayout mTablayout;
    ViewPager mViewPager;
    TablayoutFragmentPager mTablyoutFragmentPager;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        contentView = inflater.inflate(R.layout.social_fragment_layout, null);
        return contentView;
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState)
    {
        super.onViewCreated(view, savedInstanceState);
        initview();

    }

    private void initview()
    {
        mTablayout = (TabLayout) contentView.findViewById(R.id.social_tablayout);
        mViewPager = (ViewPager) contentView.findViewById(R.id.social_fragment_viewpager);
        mTablyoutFragmentPager = new TablayoutFragmentPager(getChildFragmentManager(), getContext());
        mViewPager.setAdapter(mTablyoutFragmentPager);
        mTablayout.setupWithViewPager(mViewPager);
    }
}
